package com.whz.enummap.transition;

/**
 * @Author: sinosoft
 * @Description: 状态转化
 * @Date: Create in 10:40 2021/5/17
 * @Modified By:
 */
public enum Transition {
    MELT, //融化
    FREEZE,
    BOIL,
    CONDENSE, //浓缩
    SUBLIME, // 升华
    DEPOSIT; // 沉淀
    private static final Transition[][] TRANSITIONS = {
            {null, MELT, SUBLIME},
            {FREEZE, null, BOIL},
            {DEPOSIT, CONDENSE, null}
    };
    // 从一个状态过渡到另外一个状态
    public static Transition from(Phase from, Phase to) {
        return TRANSITIONS[from.ordinal()][to.ordinal()];
    }
}
